﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Server.ActivityFeed;
using System.Reflection;
using System.Globalization;

namespace ESF.SharePoint.Utility
{
    static class ActivityTemplateExtension
    {
        //public static string GetTitleDisplayFormat(this ActivityTemplate activityTemplate)
        //{
        //    Type type = typeof(ActivityTemplate);
        //    PropertyInfo propertyFormat = type.GetProperty("TitleDisplayFormat", BindingFlags.NonPublic | BindingFlags.Instance);
        //    return (string)propertyFormat.GetValue(activityTemplate, null);
        //}

        public static string GetTitleDisplayFormat(this ActivityTemplate activityTemplate)
        {

            return ESFUtility.GetResourceString(
                activityTemplate.TitleFormatLocStringResourceFile,
                activityTemplate.TitleFormatLocStringName, (uint)CultureInfo.CurrentUICulture.LCID);
        }
    }
}
